import request from '@/utils/request'

export function getDeviceInfoList() {
  return request({
    url: '/device/getInfoList',
    method: 'get'
  })
}


export function getDeviceInfos(deviceType) {
  return request({
    url: '/device/getInfoList',
    method: 'get',
    params: { deviceType: deviceType }
  })
}


export function getDevicePageInfos(data) {
  return request({
    url: '/device/getPageInfos',
    method: 'GET',
    params: data
  })
}

export function getInfo(deviceId) {
  return request({
    url: '/device/getInfo',
    method: 'GET',
    params: { deviceId: deviceId }
  })
}

export function updateIsActive(deviceId, isActive) {
  return request({
    url: '/device/updateIsActive',
    method: 'POST',
    params: {
      deviceId: deviceId,
      isActive: isActive
    }
  })
}

export function getOptionList(optionsType, deviceType) {
  return request({
    url: '/device/getOptionsList',
    method: 'GET',
    params: { optionsType: optionsType, deviceType: deviceType }
  })
}

export function deleteDevice(deviceId) {
  return request({
    url: '/device/deleteDevice',
    method: 'DELETE',
    params: { deviceId: deviceId }
  })
}

export function createOrUpdate(data) {
  return request({
    url: '/device/addOrUpdateDevice',
    method: 'POST',
    data: data
  })
}
